<?php

    $cmd = "/bin/id -a"; 
    $cmd = "/usr/bin/locate"; 

    parse_str($argv[1], $_GET);

    if (isset($_GET['filename'])) {
        $filename = $_GET['filename'];
    }

?>

  <center>
    <table border=0 cellspacing=0>
      <tr bgcolor='#bbbbbb' align='center'>
        <form action="<?=$path;?>" method="get">
         <p>
          <input type="text" name="filename" value="<?=$filename;?>"/>
          <input type="submit" value="Locate" />
         </p>	
        </form>
      </tr>
    </table>
  </center>

<?php

    # print_r($_GET);

    if (!isset($_GET['filename'])) {
       exit;
    }
    
    print "<CENTER>$cmd '$filename'</CENTER>\n";

    $phandle = popen("time $cmd '$filename' 2>&1", "r");

    print "<P><center>\n";
    print "<table border=0 cellspacing=0 STYLE='font-family: courier'>\n";
    while(!feof($phandle)) { 
        $line = fgets($phandle); 
	$line = rtrim($line);
        print "  <TR><TD>$line</TD></TR>\n";
    }
    print "</table>\n";
    print "</P></center>\n";
?>
